use "$replication\data\IHDS_crops.dta", clear

ren FM17 sold
ren FM15 prod

fre FM10

reshape wide prod sold, i(crop) j(FM10)

foreach var in prod sold {
	ren `var'1 `var'_kharif
	ren `var'2 `var'_rabi
	ren `var'3 `var'_summer
}

gegen total_prod=rowtotal(prod_*)
gegen total_sold=rowtotal(sold_*)

gen rabi_share=prod_rabi/total_prod
gen ofrabi_sold_share=sold_rabi/prod_rabi
gen rabi_sold_share=sold_rabi/total_prod

gen sold_share=total_sold/total_prod
gsort -rabi_sold_share

keep crop rabi_share ofrabi_sold_share rabi_sold_share  

gsort -rabi_sold_share

br 